﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Common;

namespace Library
{
    public partial class NewBook : Form
    {
        public List<Book> NewBook_ { get; private set; }

        public NewBook()
        {
            InitializeComponent();
            NewBook_ = new List<Book>();
        }

        private void AddBook_btn_Click(object sender, EventArgs e)
        {
            string name = Name_txbx.Text.Trim();
            string publisher = Publisher_txbx.Text.Trim();
            DateTime publishedDate = PublishedDate_dtp.Value;
            string isbn = ISBN_txbx.Text.Trim();
                string authorName=AuthorName_txbx.Text.Trim();
            if ( name != string.Empty &&
                publisher != string.Empty &&
                publishedDate != null &&
                isbn != string.Empty &&
                authorName!= string.Empty)
            {
                NewBook_.Add(new Book(name, publisher, publishedDate, isbn, authorName));
                bookCount_lbl.Text = "Новых книг: " + NewBook_.Count;
                return;
            }
                MessageBox.Show("Не все поля указаны");
                return;
        }

        private void SaveBooks_btn_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
        }
    }
}
